/**
 * @param {string} s
 * @param {number} k
 * @return {string}
*/
var truncateSentence = function(s, k) {
  let arr = s.split(" ").slice(0, k);
  return arr.join(" ");
};
let s = "Hello how are you Contestant", k = 4;
console.log(truncateSentence(s, k));
s = "What is the solution to this problem", k = 4;
console.log(truncateSentence(s, k));
s = "chopper is not a tanuki", k = 5;
console.log(truncateSentence(s, k));
